package com.zyb;

import com.zyb.dao.BookDao;
import com.zyb.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new
                AnnotationConfigApplicationContext(SpringConfig.class);
        BookDao bookDao1 = ctx.getBean(BookDao.class);
        System.out.println(bookDao1);

        BookDao bookDao2 = ctx.getBean(BookDao.class);
        System.out.println(bookDao2);

        ctx.close(); //关闭容器

//        BookService bookService = ctx.getBean(BookService.class);
//        System.out.println(bookService);
    }
}
